package com.codeoss.framework.util;

import com.codeoss.framework.expression.Expression;
import com.codeoss.framework.view.datasource.DataSourceConfig;

public class LookupInfo {
	private DictDef dictDef;
	private DataSourceConfig dataSourceConfig;
	private String valueColumn;
	private String displayColumn;
	private Expression dynamicWhereClauseExpression;
	public DictDef getDictDef() {
		return dictDef;
	}
	public void setDictDef(DictDef dictDef) {
		this.dictDef = dictDef;
	}
	public DataSourceConfig getDataSourceConfig() {
		return dataSourceConfig;
	}
	public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
		this.dataSourceConfig = dataSourceConfig;
	}
	public String getValueColumn() {
		return valueColumn;
	}
	public void setValueColumn(String valueColumn) {
		this.valueColumn = valueColumn;
	}
	public String getDisplayColumn() {
		return displayColumn;
	}
	public void setDisplayColumn(String displayColumn) {
		this.displayColumn = displayColumn;
	}

	public Expression getDynamicWhereClauseExpression() {
		return dynamicWhereClauseExpression;
	}
	public void setDynamicWhereClauseExpression(Expression dynamicWhereClauseExpression) {
		this.dynamicWhereClauseExpression = dynamicWhereClauseExpression;
	}
	public LookupInfo clone() {
		LookupInfo lookupInfo=new LookupInfo();
		lookupInfo.dictDef=dictDef;
		lookupInfo.valueColumn=valueColumn;
		lookupInfo.displayColumn=displayColumn;
		
		if(dataSourceConfig!=null) {
			DataSourceConfig dataSourceConfig=new DataSourceConfig();
			lookupInfo.dataSourceConfig=dataSourceConfig;
			dataSourceConfig.setId(this.dataSourceConfig.getId());
			dataSourceConfig.setName(this.dataSourceConfig.getName());
			dataSourceConfig.setTableName(this.dataSourceConfig.getTableName());
			dataSourceConfig.setWhereClause(this.dataSourceConfig.getWhereClause());
			dataSourceConfig.setDynamicWhereClause(this.dataSourceConfig.getDynamicWhereClause());
			dataSourceConfig.setQuery(this.dataSourceConfig.getQuery());
			dataSourceConfig.setOrderBy(this.dataSourceConfig.getOrderBy());
		}
		return lookupInfo;
	}
}
